package com.example.wechattakeaway.controller;

import com.example.wechattakeaway.service.RoleService;
import com.example.wechattakeaway.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(value = "角色权限管理",tags = {"角色权限管理"})
@RestController
@RequestMapping("/RoleController")
public class RoleController {

    @Autowired
    RoleService roleService;

    @ApiOperation(value = "新增一个用户角色",notes = "前端不用")
    @PostMapping("/InsertRole")
    public ResultVO InsertRole(String roleName){
        return roleService.InsertRole(roleName);
    }

    @ApiOperation(value = "删除一个用户角色",notes = "前端不用")
    @PostMapping("/DeleteRole")
    public ResultVO DeleteRole(Integer roleId){
        return roleService.DeleteRole(roleId);
    }

    @ApiOperation(value = "根据id查询角色",notes = "前端不用")
    @PostMapping("/SelectRoleById")
    public ResultVO SelectRoleById(Integer roleId){
        return roleService.SelectRoleById(roleId);
    }

}
